package com.meta.platform.area.define;

import lombok.Getter;
import org.springframework.util.CollectionUtils;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * java类简单作用描述
 *
 * @Title:
 * @Package: com.metafnt.config.intf.define.
 * @Author: M.simple
 * @Remark: The modified content
 * @CreateDate: 2020/7/17 3:39 下午
 * @Version: v2.0
 */
@Getter
public enum DistrictLevelEnum {

	COUNTRY("country", 0, "国家"),
	PROVINCE("province", 1, "省"),
	CITY("city", 2, "市"),
	DISTRICT("district", 3, "区县"),
	STREET("street", 4, "街道");

	DistrictLevelEnum(String levelCode, Integer levelId, String levelName) {
		this.levelCode = levelCode;
		this.levelId = levelId;
		this.levelName = levelName;
	}

	public static DistrictLevelEnum getLevelByCode(String levelCode) {
		
		List<DistrictLevelEnum> matchTypes = Arrays.asList(DistrictLevelEnum.values()).stream().filter(msgType ->msgType.levelCode.equals(levelCode)).collect(Collectors.toList());
		if(CollectionUtils.isEmpty(matchTypes)){

		}
		return matchTypes.get(0);
	}



	/**
	 * 级别 code
	 */
	private String levelCode;

	/**
	 * 级别 id
	 */
	private Integer levelId;

	/**
	 * 级别name
	 */
	private String levelName;
}
